package piechowicz.szymon.balloonwars;

import com.google.android.maps.*;
import android.os.Bundle;
import android.view.WindowManager;

public class GameController extends MapActivity implements Game.GameListener
{
    
    private Game game;
    // Widgets
    private MapView map;
    private MapController mapController;
    
    // Activity lifecycle
    
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        
        game = new Game(this, this);
        
        setContentView(R.layout.game_activity);
        
        map = (MapView)findViewById(R.id.game_activity_map);
        
        mapController = map.getController();
        map.setSatellite(true);
        mapController.setCenter(new GeoPoint(48858165, 2294587));
        mapController.zoomToSpan(1000, 1000);
    }
    
    protected void onResume()
    {
        super.onResume();
        
        game.resume();
    }
    
    protected void onPause()
    {
        super.onPause();
        
        game.pause();
    }
    
    protected boolean isRouteDisplayed()
    {
        return false;
    }

    // GameListener
    
    public void onBalloonLocationChanged(GeoPoint location)
    {
        mapController.setCenter(location);
    }

}
